import React, { useState } from 'react'
import 'braft-editor/dist/index.css'
import BraftEditor from 'braft-editor'
function Com() {
  const [editorState, setEditorState] = useState('')
  const changeVal = (editorState) => {
    console.log(editorState.toHTML())
    setEditorState(editorState.toHTML())
  }
  return (
    <div>
      <h1>富文本编辑器</h1>
      <BraftEditor
        value={editorState}
        onChange={ changeVal }
      />
      预览
      <div dangerouslySetInnerHTML={{ __html: editorState}}></div>
    </div>
  )
}

export default Com
